#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void paintEvent(QPaintEvent *event);

    void initCanvas(QPainter& painter);//画布
    void drawMiddleCircle(QPainter& painter, int radius);//小圆圈
    void drawScale(QPainter& painter, int radius);//刻度
    void drawPointerAndLine(QPainter& painter);//指针和线
    void drawsSector(QPainter& painter, int radius);//画扇形
    void drawEllipseOutterShine(QPainter& painter, int radius);//画外圈光环
    void drawIcon(QPainter& painter, int radius);//画车标

    void startTimer();//封装计时器
private:
    Ui::Widget *ui;
    QTimer *timer;
    int currentValue;
    int flag = 0;
    double angle;//算出一个刻度需要旋转的角度
    int startAngle;//起始度数
};
#endif // WIDGET_H
